package com.xh.jf_blog.controller.front;

import com.xh.jf_blog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author PangJunjie
 * @Date 2024/2/20/020
 */
@Controller
@RequestMapping("/page")
public class PageController {
    @Autowired
    private ArticleService articleService;

    @GetMapping("/index")
    public String index() {
        return "front/index";
    }


    @GetMapping("/vip")
    public String page(int type, Model model) {
        model.addAttribute("type", type);
        return "front/vip/page";
    }

    @GetMapping("/search")
    public String search(String search, Model model) {
        model.addAttribute("search", search);
        return "front/article/search";
    }

    @GetMapping("/author")
    public String author() {
        return "front/author";
    }


    @GetMapping("/category")
    public String category() {
        return "front/category";
    }

    @GetMapping("/article/info/*")
    public String articleInfo() {
        return "front/article/info";
    }

    @GetMapping("/like/list")
    public String likePage(int articleId, int type, Model model) {
        model.addAttribute("articleId", articleId);
        model.addAttribute("type", type);
        return "front/article/author";
    }

    @GetMapping("/user/info/*")
    public String user() {
        return "front/vip/user";
    }

    @GetMapping("/password")
    public String password() {
        return "front/vip/password";
    }

    @GetMapping("/forget")
    public String forget() {
        return "front/vip/forget";
    }
}
